package com.sorhis.controller;

import com.sorhis.dto.SysParameterDTO;
import com.sorhis.dto.SysRoleDTO;
import com.sorhis.service.ISysParameterService;
import com.sorhis.vo.ResultVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 参数主表 前端控制器
 * </p>
 *
 * @author xihao.ding
 * @since 2025-02-25
 */
@RestController
@RequestMapping("/sysParameter/v1")
@RequiredArgsConstructor
public class SysParameterController {

    private final ISysParameterService sysParameterService;

    @GetMapping(value = "/list")
    public ResultVO search(SysParameterDTO sysParameterDTO) {
        return ResultVO.ok(sysParameterService.findPageList(sysParameterDTO));
    }


    @PostMapping(value = "/save")
    public ResultVO saveOrUpate(@RequestBody SysParameterDTO sysParameterDTO) {
        return ResultVO.ok(sysParameterService.saveOrUpateDomain(sysParameterDTO));
    }

    @PostMapping(value = "/del/{id}")
    public ResultVO del(@PathVariable String id) {
        return ResultVO.ok(sysParameterService.del(id));
    }

    @GetMapping(value = "/all")
    public ResultVO all() {
        return ResultVO.ok(sysParameterService.list());
    }

}
